<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ax" uri="http://peru.org.muni" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@page import="java.util.List"%>
<%@page import="muni.ilo.dto.ConceptosPagoDTO"%>
<html>
<head>
<title></title>
 <script type="text/javascript">
 

function f_ingresa(){
		//alert('hola mundo, mi mensaje Java Script');
		
		// podemos jugar con java script
		document.forms[0].action='logueo.net';
		// simulamos con javascript el comportamiento de hacer
		// clic sobre un boton tipo submit
		document.forms[0].submit();
		
	}
	
	function irPago(){
		//alert('hola mundo, mi mensaje Java Script');
		
		// podemos jugar con java script
		document.forms[0].action='CompPagoServlet.do';
		// simulamos con javascript el comportamiento de hacer
		// clic sobre un boton tipo submit
		document.forms[0].submit();
		
	}
	function f_registra(){
		var tipc = document.forms[1].tipoComprobante.selectedIndex;
		var cod = document.forms[0].codigo.value;
		if(tipc > 0 ){
			if(cod != '' ){
				document.forms[1].operacion.value='generarComprobante';
				document.forms[1].action='CompPagoServlet.do';
				//document.forms[0].action='cliente.do';
				document.forms[1].submit();
			}else{
				alert('Llene los datos del contribuyente');
			}
			
		}else{
			alert('Eliga un tipo de comprobante');
		}
		
		
	}
	
	function agregatabla(indexExt){
		var conc = document.forms[1].conceptoPago.selectedIndex;
	
		if(conc > 0){
			document.forms[1].action='CompPagoServlet.do?operacion=agregarDetalle';
			document.forms[1].submit();
		}else{
			alert('Eliga un concepto');
		}
	}
	function eliminaConcepto(cod,prec,num){
		//
	}
	function mostrarMensaje(msj){
		document.form1.codigo.focus();
		if(msj!='null' && msj != ''){
			alert(msj);
		}
}
 
 </script>
</head>
<body onload="mostrarMensaje('<%=request.getAttribute("mensajePago")%>')">
<form name="form1" method="post" action="CompPagoServlet.do">
  <table border="2" cellpadding="8">
    <tr bgcolor="#FF6600">
      <td colspan="3" class="HeaderColor">
      
        <h4><fmt:message key="cu01.titulo" /></h4>
        
      </td>
    </tr>
	<tr bgcolor="#C0C0C0">
      <td colspan="3" class="HeaderColor">
        <fmt:message key="cu01.datosCon" />    
      </td>
    </tr>

    <tr >
      <td bgcolor="#DDDDDD" width="12%" nowrap class="LabelColor" style="text-align: right">
        <label for="codigo"><fmt:message key="cu01.contCod" />  </label>
      </td>
      <td bgcolor="#DDDDDD" width="50%" class="TitleColor">
        <input type="text" id="codigo" name="codigo" readonly="readonly" size="35" value="${sessionScope.DTO_contrib.codigo}">
        <br>
      </td>
	  <td bgcolor="#DDDDDD" width="50%">
	  <input type="hidden" name="operacion" value="listacontribuyentes">
	  <input type="submit" id="btnBuscarCont" name="btnBuscarCont" value=<fmt:message key="cu01.btnBuscaCont" /> > </td>
    </tr>
    <tr style="vertical-align: top">
      <td bgcolor="#DDDDDD" style="text-align: right" class="LabelColor">
        <label for="tipo"> <fmt:message key="cu01.contTipo" /> </label>
      </td>
      <td bgcolor="#DDDDDD" colspan="2" class="TitleColor">
        <input type="text" id="tipo" name="tipo" size="35" readonly="readonly" value="${sessionScope.DTO_contrib.tipo}">
      </td>
    </tr>
    <tr  style="vertical-align: top">
      <td bgcolor="#DDDDDD" style="text-align: right" class="LabelColor">
        <label for="nomcomp"> <fmt:message key="cu01.contNom" />
        </label>
      </td>
      <td bgcolor="#DDDDDD" colspan="2" class="TitleColor">
        <input type="text" id="nomcomp" name="nomcomp" readonly="readonly" size="40" value="${sessionScope.DTO_contrib.nombreCom}">
      </td>
    </tr>
    <tr >
      <td bgcolor="#DDDDDD" style="text-align: right" class="LabelColor">
        <label for="direccion"><fmt:message key="cu01.contDire" /></label>
      </td>
      <td bgcolor="#DDDDDD" colspan="2" class="TitleColor">
        <input type="text" id="direccion" name="direccion"  size="40" value="${sessionScope.DTO_contrib.lugRes}" readonly="readonly">
      </td>
    </tr>
    </table>
    </form>
    
<form name="form2" method="post" action="CompPagoServlet.do">
    
    <table border="2" cellpadding="8">
	<tr bgcolor="#C0C0C0">
      <td colspan="3"  class="HeaderColor" > 
       <fmt:message key="cu01.tituloConcPago" /> 
      </td>
    </tr>
    <tr style="vertical-align: top">
      <td bgcolor="#DDDDDD" style="text-align: right" class="LabelColor">
        <label for="tipcomp"><fmt:message key="cu01.tipoComp" /> </label>
      </td>
      <td bgcolor="#DDDDDD" colspan="2" class="TitleColor">
      
        <ax:comboTipoComprobante nombre="tipoComprobante"/>
      </td>
    </tr>
    <tr style="vertical-align: top">
      <td bgcolor="#DDDDDD" style="text-align: right" class="LabelColor">
        <label for="ctramitacion"><fmt:message key="cu01.conceptTra" /></label>
      </td>
      <td bgcolor="#DDDDDD" width="45%" class="TitleColor" style="width: 173px">
      <ax:comboPago nombre="conceptoPago"/>
						
  
      </td>
	  <td bgcolor="#DDDDDD" width="55%" class="TitleColor">
	  <input type="hidden" name="operacion" value="agregarDetalle">
	  <input type="hidden" name="tipcomp" value="">
	  	<input type="button" id="btnAgregar" name="btnAgregar" value=<fmt:message key="cu01.btnAgre" /> onclick="agregatabla();">
	  
	  </td>
    </tr>
	<tr bgcolor="#C0C0C0">
      <td colspan="3" class="HeaderColor">  
       <fmt:message key="cu01.detalleTitPago" />  
      </td>
    </tr>
        <tr bgcolor="#DDDDDD" style="vertical-align: top">
 		<td colspan="3">
 						
	
		<table width="550" border="3" id="tbLiq">
  <tr bgcolor="00D0E8">
  	<th scope="col"><div align="center"><em><strong><fmt:message key="cu01.tablaConcePa" /> </strong></em></div></th>
    <th scope="col"><div align="center"><em><strong><fmt:message key="cu01.tablaPrecio" />  </strong></em></div></th>
    <th scope="col"><div align="center"><em><strong><fmt:message key="cu01.tablaElim" /> </strong></em></div></th>
  </tr>
  <c:if test="${sessionScope.lista_Conceptos!=null}">
  <c:forEach var="conceptos" items="${sessionScope.lista_Conceptos}" varStatus="st" >
  <tr bgcolor="#FFFFFF">
    <td>${conceptos.conceptoPago } </td>
    <td>${conceptos.precioPago } </td>
    <td><a  href="CompPagoServlet.do?operacion=eliminarConcepto&codigoConcepto=${conceptos.codigoConceptoPago}&precio=${conceptos.precioPago}&num=${st.index}" ><fmt:message key="cu01.listaLinkEli" /></a>  	</td>
  </tr>
  </c:forEach>
  </c:if>
</table>

		</td>
    </tr>
    <tr bgcolor="#DDDDDD" style="vertical-align: top" class="FooterColor">
		<td style="text-align: right" class="LabelColor">
        	&nbsp;
      </td>
      <td  style="text-align: right" class="LabelColor">
        <label for="subtotal"><fmt:message key="cu01.subTotl" /> </label>
      </td>
	  <td align="left">
        <input type="text" id="subtotal" name="subtotal" readonly="readonly" value="${sessionScope.subtotal}"> 
      </td>
    </tr>
    <tr bgcolor="#DDDDDD" style="vertical-align: top" class="FooterColor">
		<td style="text-align: right" class="LabelColor">
        	&nbsp;
      </td>
      <td  style="text-align: right" class="LabelColor">
        <label for="igv"><fmt:message key="cu01.igv" /> </label>
      </td>
	  <td align="left">
        <input type="text" id="igv" name="igv" readonly="readonly" value="${sessionScope.igv}">
      </td>
    </tr>
    <tr bgcolor="#DDDDDD" style="vertical-align: top" class="FooterColor">
		<td style="text-align: right" class="LabelColor">
		<c:if test="${requestScope.countConc == 5}">
			<input type="button"  id="btnGenComp" name="btnGenComp" value=<fmt:message key="cu01.genCon" /> onclick=f_registra()>&nbsp;
		</c:if>
		<c:if test="${requestScope.countConc < 5}">
			<input type="button" disabled="disabled" id="btnGenComp" name="btnGenComp" value=<fmt:message key="cu01.genCon" /> onclick=f_registra()>&nbsp;
		</c:if>
       	<c:if test="${requestScope.countConc == null}">
			<input type="button" disabled="disabled" id="btnGenComp" name="btnGenComp" value=<fmt:message key="cu01.genCon" /> onclick=f_registra()>&nbsp;
		</c:if>
      </td>
      <td  style="text-align: right" class="LabelColor">
        <label for="total"> <fmt:message key="cu01.total" />  </label>
      </td>
	  <td align="left">
        <input type="text" id="total" name="total" readonly="readonly" value="${sessionScope.total}">
      </td>
    </tr>
	
     

    
    </table>
</form>  
</body>
</html>
    